package com.singzi.leetcode.N800;

public class T0747 {
}
class Solution0747 {
    public int dominantIndex(int[] nums) {
        if(nums.length==1) return 0;
        int index = 0;
//        int max = nums[0];
        int n = nums.length;
        for (int i = 1; i < n; i++) {
            if(nums[i] > nums[index]){
                index = i;
            }
        }
        for (int i = 0; i < n; i++) {
            if(i == index) continue;
            if(nums[i]*2>nums[index]) return -1;
        }
        return index;

    }
}